package service;

import DAO.OrderDaoImpl;
import beans.Order;
import beans.User;
import utils.DateUtil;

public class OrderService {
    public static void addcOrderService(User user, String name, String price,String merchant,String producer) {
        OrderDaoImpl orderDaoImpl = new OrderDaoImpl();
        Order order = new Order();
        order.setUser(user.getName());
        order.setTime(DateUtil.getDataTimeNow());
        order.setName(name);
        order.setPrice(price);
        order.setMerchant(merchant);
        order.setProducer(producer);
        orderDaoImpl.addcOrder(order);
    }

    //缺货
    public static void addcReplenishmentService(User user, String name, String price,String merchant,String producer) {
        OrderDaoImpl orderDaoImpl = new OrderDaoImpl();
        Order order = new Order();
        order.setUser(user.getName());
        order.setTime(DateUtil.getDataTimeNow());
        order.setName(name);
        order.setPrice(price);
        order.setMerchant(merchant);
        order.setProducer(producer + "(未补货)");
        orderDaoImpl.addcOrder(order);
    }

}
